using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;

using SharpCore.Data;
using SystemFramework.Util;

namespace TF.Access {

    public class ViewCountObject
    {
        private int id;
        private string name;
        private int viewCount;

        public int Id
        {
            get
            {
                return id;
            }
            set
            {
                id = value;
            }
        }

        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                name = value;
            }
        }

        public int ViewCount
        {
            get
            {
                return viewCount;
            }
            set
            {
                viewCount = value;
            }
        }
    }

	public partial class TF_Province {

        public static List<ViewCountObject> SelectCityViewCountByProvinceId(int provinceId)
        {
            using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader("TF_SelectCityViewCountByProvinceId", provinceId))
            {
                List<ViewCountObject> viewCountList = new List<ViewCountObject>();
                while (dataReader.Read())
                {
                    ViewCountObject vcc = new ViewCountObject();
                    vcc.Id = ConvertHelper.GetInt(dataReader["Id"], 0);
                    vcc.ViewCount = ConvertHelper.GetInt(dataReader["ViewCount"], 0);
                    vcc.Name = ConvertHelper.GetString(dataReader["Name"], string.Empty);
                    viewCountList.Add(vcc);
                }
                return viewCountList;
            }
        }

        public static List<ViewCountObject> SelectProvinceViewCountByCountryId(int countryId)
        {
            using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader("TF_SelectProvinceViewCountByCountryId", countryId))
            {
                List<ViewCountObject> viewCountList = new List<ViewCountObject>();
                while (dataReader.Read())
                {
                    ViewCountObject vcc = new ViewCountObject();
                    vcc.Id = ConvertHelper.GetInt(dataReader["Id"], 0);
                    vcc.ViewCount = ConvertHelper.GetInt(dataReader["ViewCount"], 0);
                    vcc.Name = ConvertHelper.GetString(dataReader["Name"], string.Empty);
                    viewCountList.Add(vcc);
                }
                return viewCountList;
            }
        }

        public static List<ViewCountObject> SelectCountryViewCountByCountryId(int countryId)
        {
            using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader("TF_SelectCountryViewCountByCountryId", countryId))
            {
                List<ViewCountObject> viewCountList = new List<ViewCountObject>();
                while (dataReader.Read())
                {
                    ViewCountObject vcc = new ViewCountObject();
                    vcc.Id = ConvertHelper.GetInt(dataReader["Id"], 0);
                    vcc.ViewCount = ConvertHelper.GetInt(dataReader["ViewCount"], 0);
                    vcc.Name = ConvertHelper.GetString(dataReader["Name"], string.Empty);
                    viewCountList.Add(vcc);
                }
                return viewCountList;
            }
        }
	}
}
